#pragma once

#include "Types.h"
#include <MyControls/CompositeProperty.h>

namespace xml { class stream; }

struct MaskMode
{
	enum Mode {
		None, Add, Subtract, Intersect, Lighten, Darken, Difference, Substitute
	};
	Mode mode;
	bool inverted;

	bool operator == (MaskMode const & rhs) const
		{ return mode == rhs.mode && inverted == rhs.inverted; }
	bool operator != (MaskMode const & rhs) const
		{ return !(*this == rhs); }
};

xml::stream & operator || (xml::stream & s, MaskMode & mm);

template <>
class My::Property<MaskMode> : public My::StructProperty<MaskMode> {
public:
	Property();
public:
	virtual void Init();
};

//first_mask is true if comp is not initialized yet
void AddMask(BitMask & comp, BitMask const & mask, MaskMode mm, bool first_mask = false);
void AddMask(GreyMask & comp, GreyMask const & mask, MaskMode mm, bool first_mask = false);
